package com.huawei.hwCloudJs.core.a;

import android.text.TextUtils;
import com.huawei.hwCloudJs.annotation.JSMethod;
import com.huawei.hwCloudJs.core.JSRequest;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;

public class b {
    private static b b = new b();
    private final Map<String, a> a = new HashMap();

    public static b a() {
        return b;
    }

    public void a(Class<? extends JSRequest> cls) {
        for (Method method : cls.getMethods()) {
            if (method.isAnnotationPresent(JSMethod.class)) {
                Object name = ((JSMethod) method.getAnnotation(JSMethod.class)).name();
                if (TextUtils.isEmpty(name)) {
                    name = method.getName();
                }
                this.a.put(name, new a(method));
            }
        }
    }

    public void a(String str) {
        if (this.a.containsKey(str)) {
            this.a.remove(str);
        }
    }

    public a b(String str) {
        return (a) this.a.get(str);
    }
}
